package clientSide;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

import org.json.simple.JSONObject;

/**
 * decission for parametrs of this,
 * @author FERi
 */

public class Player {
	private String username;
	private Socket socket;
	private ObjectOutputStream oos;
	private ObjectInputStream ois;
	
	public Player(Socket socket, ObjectOutputStream oos, ObjectInputStream ois, String username) {
		this.username = username;
		this.oos = oos;
		this.ois = ois;
		this.socket = socket;
	}
	public Player(Socket socket, ObjectOutputStream oos, ObjectInputStream ois) {
		this.oos = oos;
		this.ois = ois;
		this.socket = socket;
	}
	public Player(Player p) {
		username = p.getName();
		socket = p.getSocket();
		oos = p.getObjectOutputStream();
		ois = p.getObjectInputStream();
	}
	
	public Socket getSocket() {
		return socket;
	}
	
	public ObjectOutputStream getObjectOutputStream() {
		return oos;
	}
	
	public ObjectInputStream getObjectInputStream() {
		return ois;
	}
	
	public void setName(String username) {
		this.username = username;
	}
	public String getName() {
		return this.username;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Player) {
			if(this.username.equals(((Player)obj).getName()))
				return true;
			else
				return false;
		}
		return super.equals(obj);
	}
}
